package com.example.leetcode.niuke;

import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class NiuKe14 {


    public static Integer minTime = null;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        List<Integer> collect = Arrays.stream(scanner.nextLine().split(" ")).map(Integer::parseInt).collect(Collectors.toList());
        transport(collect.get(0),collect.get(1),0,0,collect.get(2),0);
        if (minTime == null) {
            System.out.println(0);
        }else {
            System.out.println(minTime);
        }
    }



    public static void transport(int m,int n,int m1,int n1,int x,int times) {
        if (x >= m + n) {
            if (minTime == null || times + 1 < minTime) {
                minTime = times + 1;
            }
            return;
        }
        for (int i = 0; i<=x && i <= m;i++) {
            for (int j = 0 ;j <= n && (i + j) <= x ;j++) {
                if (i + j == 0) {
                    continue;
                }
                if ((m - i == 0 || m - i > n - j) && (m1 + i == 0 || m1 + i > n1 + j)) {
                    transport(m - i ,n- j,m1 +i,n1 + j,x ,times+ 1);
                }
            }
        }
        return;
    }
}
